<script setup>

import {Message, ShoppingBag, Stamp} from "@element-plus/icons-vue";
import {useRouter} from "vue-router";
const route = useRouter()
const props = defineProps({
  title: {
    type: String,
    default: ''
  },
  index: {
    type: Number,
    default: 0
  }
})
</script>

<template>
  <div class="head">
    <button class="back-button" @click="route.push('/')">回到首页</button>
    <div class="title">
      <el-icon size="30">
        <Message style="margin-top: 5px;" v-if="index === 0"/>
        <ShoppingBag style="margin-top: 1px;" v-if="index === 1"/>
        <Stamp style="margin-top:3px;" v-if="index === 2"/>
      </el-icon>
      <p>{{props.title}}</p>
    </div>
  </div>
</template>

<style scoped>
.head {
  height: 8%;
  width: 100%;
  background-color: #55a1e0;
  display: flex;
  align-items: center;
  justify-content: center;

  .back-button {
    position: absolute;
    width: 100px;
    height: 35px;
    left: 2%;
    border-radius: 10px;
    border: none;

    &:hover {
      background-color: #d7d6d6;
      cursor: pointer;
    }
  }

  .title {
    display: flex;
    align-items: center;
    font-size: 24px;
    color: white;

    p {
      margin: 0 14px;
    }
  }
}
</style>